package com.grass.p019lv.novel.activity;

import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.net.Uri;
import android.text.TextUtils;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.TextView;
import androidx.core.view.ViewCompat;
import androidx.core.widget.NestedScrollView;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.APPLink;
import com.androidx.p013lv.base.bean.AdInfoBean;
import com.androidx.p013lv.base.bean.NovelHistory;
import com.androidx.p013lv.base.bean.novel.Chapters;
import com.androidx.p013lv.base.bean.novel.FictionList;
import com.androidx.p013lv.base.bean.novel.NovelChapterBean;
import com.androidx.p013lv.base.bean.novel.NovelDetailBean;
import com.androidx.p013lv.base.bean.novel.NovelGuessLikeBean;
import com.androidx.p013lv.base.dialog.BuyVipDialog;
import com.androidx.p013lv.base.glide.GlideUtils;
import com.androidx.p013lv.base.http.BaseRes;
import com.androidx.p013lv.base.http.HttpUtils;
import com.androidx.p013lv.base.http.UrlManager;
import com.androidx.p013lv.base.http.callback.HttpCallback;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.p015ui.BaseActivity;
import com.androidx.p013lv.base.service.AdClickService;
import com.androidx.p013lv.base.utils.AdUtils;
import com.androidx.p013lv.base.utils.NovelHistoryUtils;
import com.androidx.p013lv.base.utils.SpUtils;
import com.androidx.p013lv.base.utils.ToastUtils;
import com.androidx.p013lv.base.utils.UiUtils;
import com.grass.p019lv.databinding.ActivityNovelBinding;
import com.grass.p019lv.dialog.CancelableDialogLoading;
import com.grass.p019lv.novel.adapter.NovelGuessLikeAdapter;
import com.grass.p019lv.novel.adapter.NovelMenuAdapter;
import com.grass.p019lv.novel.fragment.NovelCommentFragment;
import com.grass.p019lv.novel.viewmodel.NovelModel;
import com.grass.p019lv.utils.ReadTxtUtil;
import com.gyf.immersionbar.ImmersionBar;
import com.zhy.view.flowlayout.FlowLayout;
import com.zhy.view.flowlayout.TagAdapter;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import p023io.reactivex.Observable;
import p023io.reactivex.ObservableEmitter;
import p023io.reactivex.ObservableOnSubscribe;
import p023io.reactivex.android.schedulers.AndroidSchedulers;
import p023io.reactivex.disposables.CompositeDisposable;
import p023io.reactivex.functions.Action;
import p023io.reactivex.functions.Consumer;
import p023io.reactivex.schedulers.Schedulers;

/* renamed from: com.grass.lv.novel.activity.NovelActivity */
public class NovelActivity extends BaseActivity<ActivityNovelBinding> implements NovelCommentFragment.NovelCommentInterface {
    NovelGuessLikeAdapter adapter;
    private Animation animationIn;
    private Animation animationOut;
    private APPLink appLink;
    private List<Integer> chapterIdList = new ArrayList();
    private int commentNum;
    private CompositeDisposable compositeDisposable;
    private LinearLayout ll_root;
    private CancelableDialogLoading loading;
    private int novelChapterId;
    private NovelCommentFragment novelCommentFragment;
    private NovelDetailBean novelDetailBean;
    private int novelId;
    private NovelMenuAdapter novelMenuAdapter;
    private NovelModel novelModel;
    private PopupWindow popMenu;
    private View pop_view;
    private TextView tv_menu_title;

    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public int setLayout() {
        return R.layout.activity_novel;
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initImmersionBar() {
        super.initImmersionBar();
        ImmersionBar.with(this).titleBar(((ActivityNovelBinding) this.binding).toolBar).init();
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void dialogDismiss() {
        try {
            if (this.loading != null && this.loading.isShowing()) {
                this.loading.dismiss();
            }
        } catch (Exception unused) {
            this.loading = null;
        }
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initView() {
        super.initView();
        CancelableDialogLoading cancelableDialogLoading = new CancelableDialogLoading(this);
        this.loading = cancelableDialogLoading;
        cancelableDialogLoading.setTvHint("");
        this.loading.show();
        this.novelId = getIntent().getIntExtra(Key.NOVEL_ID, 0);
        NovelCommentFragment newInstance = NovelCommentFragment.newInstance();
        this.novelCommentFragment = newInstance;
        newInstance.setCommentInterface(this);
        ((ActivityNovelBinding) this.binding).setClick(new OnClick());
        this.novelModel = (NovelModel) new ViewModelProvider(this).get(NovelModel.class);
        ((ActivityNovelBinding) this.binding).recycler.setLayoutManager(new LinearLayoutManager(getActivity()));
        this.adapter = new NovelGuessLikeAdapter();
        ((ActivityNovelBinding) this.binding).recycler.setAdapter(this.adapter);
        ((ActivityNovelBinding) this.binding).recycler.setNestedScrollingEnabled(false);
        this.adapter.setItemListener(new ItemClickListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C30741 */

            @Override // com.androidx.p013lv.base.listener.ItemClickListener
            public void onItemClick(View view, int i) {
                if (SpUtils.getInstance().getUserInfo().getFreeWatches() != -1) {
                    new BuyVipDialog(NovelActivity.this).show();
                    return;
                }
                FictionList fictionList = (FictionList) NovelActivity.this.adapter.getDataInPosition(i);
                if (NovelActivity.this.loading != null && !NovelActivity.this.loading.isShowing()) {
                    NovelActivity.this.loading.show();
                }
                NovelActivity.this.novelModel.getNovelInfo(fictionList.getFictionId());
                ((ActivityNovelBinding) NovelActivity.this.binding).scrollView.scrollTo(0, 0);
            }
        });
        initPopUpView();
        ((ActivityNovelBinding) this.binding).scrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C30792 */

            @Override // androidx.core.widget.NestedScrollView.OnScrollChangeListener
            public void onScrollChange(NestedScrollView nestedScrollView, int i, int i2, int i3, int i4) {
                if (i2 == 0) {
                    ((ActivityNovelBinding) NovelActivity.this.binding).tvToolTitle.setVisibility(8);
                } else {
                    ((ActivityNovelBinding) NovelActivity.this.binding).tvToolTitle.setVisibility(0);
                }
            }
        });
        setAd();
    }

    /* access modifiers changed from: package-private */
    public void setAd() {
        final AdInfoBean novelAd = AdUtils.getInstance().getNovelAd();
        if (novelAd == null) {
            ((ActivityNovelBinding) this.binding).rlAd.setVisibility(8);
            ((ActivityNovelBinding) this.binding).ivAd.setVisibility(8);
            ((ActivityNovelBinding) this.binding).tvAd.setVisibility(8);
            return;
        }
        ViewGroup.LayoutParams layoutParams = ((ActivityNovelBinding) this.binding).rlAd.getLayoutParams();
        layoutParams.height = ((UiUtils.getWindowWidth() - UiUtils.dp2px(20)) * 120) / 400;
        ((ActivityNovelBinding) this.binding).rlAd.setLayoutParams(layoutParams);
        ((ActivityNovelBinding) this.binding).rlAd.setVisibility(0);
        ((ActivityNovelBinding) this.binding).ivAd.setVisibility(0);
        ((ActivityNovelBinding) this.binding).tvAd.setVisibility(0);
        GlideUtils.loadCropRadius(SpUtils.getInstance().getString("domain") + novelAd.getAdImage(), 4, ((ActivityNovelBinding) this.binding).ivAd);
        ((ActivityNovelBinding) this.binding).ivAd.setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.View$OnClickListenerC30803 */

            public void onClick(View view) {
                if (novelAd.getJumpType() == 2) {
                    try {
                        Intent intent = new Intent();
                        intent.setAction("android.intent.action.VIEW");
                        intent.setData(Uri.parse(novelAd.getAdJump()));
                        NovelActivity.this.startActivity(intent);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                } else {
                    if (NovelActivity.this.appLink == null) {
                        NovelActivity novelActivity = NovelActivity.this;
                        novelActivity.appLink = new APPLink(novelActivity.getActivity());
                    }
                    NovelActivity.this.appLink.urlLink(novelAd.getAdJump());
                }
                Intent intent2 = new Intent(NovelActivity.this.getActivity(), AdClickService.class);
                intent2.putExtra("adId", novelAd.getAdId());
                NovelActivity.this.getActivity().startService(intent2);
            }
        });
    }

    /* access modifiers changed from: protected */
    @Override // com.androidx.p013lv.base.p015ui.BaseActivity
    public void initData() {
        super.initData();
        this.novelModel.getNovelInfoData().observe(this, new Observer<BaseRes<NovelDetailBean>>() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C30814 */

            public void onChanged(BaseRes<NovelDetailBean> baseRes) {
                if (200 == baseRes.getCode() && baseRes.getData() != null) {
                    NovelActivity.this.novelDetailBean = baseRes.getData();
                    List<NovelDetailBean.TagList> tagList = baseRes.getData().getTagList();
                    if (tagList != null && tagList.size() > 0) {
                        NovelActivity.this.setNovelTag(tagList);
                    }
                    List<Chapters> chapters = baseRes.getData().getChapters();
                    NovelActivity.this.novelChapterId = chapters.get(0).getChapterId();
                    NovelActivity.this.novelModel.getNovelChpaterInfo(NovelActivity.this.novelId, NovelActivity.this.novelChapterId);
                    NovelActivity.this.novelMenuAdapter.setChapterId(NovelActivity.this.novelChapterId);
                    if (chapters != null && chapters.size() > 0) {
                        NovelActivity.this.novelMenuAdapter.setData(chapters);
                        NovelActivity.this.chapterIdList.clear();
                        for (int i = 0; i < chapters.size(); i++) {
                            NovelActivity.this.chapterIdList.add(Integer.valueOf(chapters.get(i).getChapterId()));
                        }
                    }
                    TextView textView = NovelActivity.this.tv_menu_title;
                    textView.setText(baseRes.getData().getFictionTitle() + "");
                    TextView textView2 = ((ActivityNovelBinding) NovelActivity.this.binding).tvToolTitle;
                    textView2.setText(baseRes.getData().getFictionTitle() + "");
                    if (NovelActivity.this.novelDetailBean.getIsLike()) {
                        ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(0);
                        ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(R.drawable.ic_novel_collect_ok);
                    } else {
                        ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(0);
                        ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(R.drawable.ic_novel_collect_no);
                    }
                    NovelActivity novelActivity = NovelActivity.this;
                    novelActivity.insertHistory(novelActivity.novelDetailBean);
                }
            }
        });
        this.novelModel.getNovelChapterInfoData().observe(this, new Observer<BaseRes<NovelChapterBean>>() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C30825 */

            public void onChanged(final BaseRes<NovelChapterBean> baseRes) {
                if (200 == baseRes.getCode() && !TextUtils.isEmpty(baseRes.getData().getPlayPath())) {
                    ((ActivityNovelBinding) NovelActivity.this.binding).scrollView.scrollTo(0, 0);
                    NovelActivity.this.commentNum = baseRes.getData().getCommentNum();
                    TextView textView = ((ActivityNovelBinding) NovelActivity.this.binding).tvComment;
                    textView.setText(NovelActivity.this.commentNum + "");
                    TextView textView2 = ((ActivityNovelBinding) NovelActivity.this.binding).tvDonate;
                    textView2.setText(baseRes.getData().getIncome() + "");
                    TextView textView3 = ((ActivityNovelBinding) NovelActivity.this.binding).tvNovelTitle;
                    textView3.setText(baseRes.getData().getChapterTitle() + "");
                    ((ActivityNovelBinding) NovelActivity.this.binding).tvNovel.setText("");
                    NovelActivity.this.compositeDisposable = new CompositeDisposable();
                    if (!TextUtils.isEmpty(baseRes.getData().getPlayPath())) {
                        NovelActivity.this.compositeDisposable.add(Observable.create(new ObservableOnSubscribe<String>() {
                            /* class com.grass.p019lv.novel.activity.NovelActivity.C30825.C30852 */

                            @Override // p023io.reactivex.ObservableOnSubscribe
                            public void subscribe(ObservableEmitter<String> observableEmitter) {
                                observableEmitter.onNext(ReadTxtUtil.readTxt(((NovelChapterBean) baseRes.getData()).getPlayPath()));
                            }
                        }).subscribeOn(Schedulers.m1118io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Consumer<String>() {
                            /* class com.grass.p019lv.novel.activity.NovelActivity.C30825.C30831 */

                            public void accept(String str) throws Exception {
                                NovelActivity.this.dialogDismiss();
                                ((ActivityNovelBinding) NovelActivity.this.binding).tvNovel.setText(str);
                                if ("加载出错".equals(str)) {
                                    ((ActivityNovelBinding) NovelActivity.this.binding).tvNovel.setOnClickListener(new View.OnClickListener() {
                                        /* class com.grass.p019lv.novel.activity.NovelActivity.C30825.C30831.View$OnClickListenerC30841 */

                                        public void onClick(View view) {
                                            if (NovelActivity.this.loading != null && !NovelActivity.this.loading.isShowing()) {
                                                NovelActivity.this.loading.show();
                                            }
                                            NovelActivity.this.novelModel.getNovelInfo(NovelActivity.this.novelId);
                                            NovelActivity.this.getGuessLike(NovelActivity.this.novelId);
                                        }
                                    });
                                } else {
                                    ((ActivityNovelBinding) NovelActivity.this.binding).tvNovel.setOnClickListener(null);
                                }
                                if (NovelActivity.this.compositeDisposable != null) {
                                    NovelActivity.this.compositeDisposable.dispose();
                                }
                            }
                        }, new C3127a(this)));
                    }
                }
            }

            public /* synthetic */ void lambda$onChanged$0$NovelActivity$5(Throwable th) throws Exception {
                NovelActivity.this.dialogDismiss();
            }
        });
        this.novelModel.getNovelInfo(this.novelId);
        getGuessLike(this.novelId);
    }

    /* access modifiers changed from: protected */
    @Override // androidx.fragment.app.FragmentActivity
    public void onNewIntent(Intent intent) {
        super.onNewIntent(intent);
        this.loading.show();
        int intExtra = intent.getIntExtra(Key.NOVEL_ID, 0);
        this.novelId = intExtra;
        this.novelModel.getNovelInfo(intExtra);
        getGuessLike(this.novelId);
    }

    public void insertHistory(NovelDetailBean novelDetailBean2) {
        String coverImg = (novelDetailBean2.getCoverImg() == null || TextUtils.isEmpty(novelDetailBean2.getCoverImg())) ? "" : novelDetailBean2.getCoverImg();
        List<NovelDetailBean.TagList> tagList = novelDetailBean2.getTagList();
        ArrayList arrayList = new ArrayList();
        if (tagList != null && tagList.size() > 0) {
            for (int i = 0; i < tagList.size(); i++) {
                arrayList.add(tagList.get(i).getTitle());
            }
        }
        NovelHistory novelHistory = new NovelHistory(coverImg, novelDetailBean2.getFakeLikes(), novelDetailBean2.getFakeWatchTimes(), novelDetailBean2.getFictionId(), novelDetailBean2.getFictionSpace(), novelDetailBean2.getFictionTitle(), novelDetailBean2.getFictionType(), novelDetailBean2.getInfo(), arrayList);
        final CompositeDisposable compositeDisposable2 = new CompositeDisposable();
        compositeDisposable2.add(NovelHistoryUtils.getInstance().insert(novelHistory).subscribeOn(Schedulers.m1118io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Action() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C30866 */

            @Override // p023io.reactivex.functions.Action
            public void run() throws Exception {
                Log.e("---->", "add----ok");
                compositeDisposable2.clear();
            }
        }));
    }

    private void initPopUpView() {
        this.animationIn = AnimationUtils.loadAnimation(this, R.anim.pop_window_in);
        this.animationOut = AnimationUtils.loadAnimation(this, R.anim.pop_window_out);
        View inflate = View.inflate(this, R.layout.popup_novel_with_navi, null);
        this.pop_view = inflate;
        this.ll_root = (LinearLayout) inflate.findViewById(R.id.ll_root);
        this.tv_menu_title = (TextView) this.pop_view.findViewById(R.id.tv_menu_title);
        this.animationOut.setAnimationListener(new Animation.AnimationListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.animationAnimation$AnimationListenerC30877 */

            public void onAnimationRepeat(Animation animation) {
            }

            public void onAnimationStart(Animation animation) {
            }

            public void onAnimationEnd(Animation animation) {
                NovelActivity.this.popMenu.dismiss();
            }
        });
        this.novelMenuAdapter = new NovelMenuAdapter();
        final RecyclerView recyclerView = (RecyclerView) this.pop_view.findViewById(R.id.recycler);
        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        recyclerView.setAdapter(this.novelMenuAdapter);
        this.pop_view.findViewById(R.id.btn_v_out).setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.View$OnClickListenerC30888 */

            public void onClick(View view) {
                NovelActivity.this.ll_root.startAnimation(NovelActivity.this.animationOut);
            }
        });
        this.pop_view.findViewById(R.id.tv_go_bottom).setOnClickListener(new View.OnClickListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.View$OnClickListenerC30899 */

            public void onClick(View view) {
                recyclerView.scrollToPosition(NovelActivity.this.novelMenuAdapter.getItemCount() - 1);
            }
        });
        this.novelMenuAdapter.setItemListener(new ItemClickListener() {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C307510 */

            @Override // com.androidx.p013lv.base.listener.ItemClickListener
            public void onItemClick(View view, int i) {
                NovelActivity.this.ll_root.startAnimation(NovelActivity.this.animationOut);
                Chapters chapters = (Chapters) NovelActivity.this.novelMenuAdapter.getDataInPosition(i);
                NovelActivity.this.novelModel.getNovelChpaterInfo(NovelActivity.this.novelId, chapters.getChapterId());
                NovelActivity.this.novelMenuAdapter.setChapterId(chapters.getChapterId());
                NovelActivity.this.novelChapterId = chapters.getChapterId();
            }
        });
        PopupWindow popupWindow = new PopupWindow(this.pop_view, -1, -1);
        this.popMenu = popupWindow;
        popupWindow.setOutsideTouchable(true);
        this.popMenu.setBackgroundDrawable(new ColorDrawable());
        this.popMenu.setClippingEnabled(false);
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void getGuessLike(int i) {
        HttpUtils.getInsatance().get(UrlManager.getInsatance().getNovelGuessLike(i), new HttpCallback<BaseRes<NovelGuessLikeBean>>("getGuessLike") {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C307611 */

            public void onLvSuccess(BaseRes<NovelGuessLikeBean> baseRes) {
                if (baseRes.getCode() == 200) {
                    NovelActivity.this.adapter.setData(baseRes.getData().getData());
                }
            }
        });
    }

    /* access modifiers changed from: private */
    /* access modifiers changed from: public */
    private void setNovelTag(final List<NovelDetailBean.TagList> list) {
        ((ActivityNovelBinding) this.binding).flowType.setAdapter(new TagAdapter<NovelDetailBean.TagList>(list) {
            /* class com.grass.p019lv.novel.activity.NovelActivity.C307712 */

            public View getView(FlowLayout flowLayout, final int i, NovelDetailBean.TagList tagList) {
                LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(flowLayout.getContext()).inflate(R.layout.item_novel_tag, (ViewGroup) flowLayout, false);
                TextView textView = (TextView) linearLayout.findViewById(R.id.tv_title);
                textView.setText(((NovelDetailBean.TagList) list.get(i)).getTitle());
                textView.setTextColor(new Random().nextInt(ViewCompat.MEASURED_SIZE_MASK) | ViewCompat.MEASURED_STATE_MASK);
                textView.setOnClickListener(new View.OnClickListener() {
                    /* class com.grass.p019lv.novel.activity.NovelActivity.C307712.View$OnClickListenerC30781 */

                    public void onClick(View view) {
                        if (!NovelActivity.this.isOnClick()) {
                            Intent intent = new Intent(NovelActivity.this, NovelLabelActivity.class);
                            intent.putExtra(Key.TITLE, ((NovelDetailBean.TagList) list.get(i)).getTitle());
                            intent.putExtra("tagId", ((NovelDetailBean.TagList) list.get(i)).getTagId());
                            NovelActivity.this.startActivity(intent);
                        }
                    }
                });
                return linearLayout;
            }
        });
    }

    @Override // com.grass.p019lv.novel.fragment.NovelCommentFragment.NovelCommentInterface
    public void addCommentNum(int i, int i2) {
        this.commentNum = i2;
        TextView textView = ((ActivityNovelBinding) this.binding).tvComment;
        textView.setText(this.commentNum + "");
    }

    /* renamed from: com.grass.lv.novel.activity.NovelActivity$OnClick */
    public class OnClick {
        public OnClick() {
        }

        public void btnBack() {
            NovelActivity.this.finish();
        }

        public void novelMenu() {
            NovelActivity.this.ll_root.startAnimation(NovelActivity.this.animationIn);
            NovelActivity.this.popMenu.showAtLocation(((ActivityNovelBinding) NovelActivity.this.binding).rootView, 17, 0, 0);
        }

        public void nextChapter() {
            if (NovelActivity.this.chapterIdList != null && NovelActivity.this.chapterIdList.size() > 0) {
                int indexOf = NovelActivity.this.chapterIdList.indexOf(Integer.valueOf(NovelActivity.this.novelChapterId));
                if (indexOf != NovelActivity.this.chapterIdList.size() - 1) {
                    NovelActivity novelActivity = NovelActivity.this;
                    novelActivity.novelChapterId = ((Integer) novelActivity.chapterIdList.get(indexOf + 1)).intValue();
                    NovelActivity.this.novelModel.getNovelChpaterInfo(NovelActivity.this.novelId, NovelActivity.this.novelChapterId);
                    NovelActivity.this.novelMenuAdapter.setChapterId(NovelActivity.this.novelChapterId);
                    return;
                }
                ToastUtils.getInstance().showSigh("没有更多了");
            }
        }

        public void collectNovel() {
            NovelActivity.this.novelModel.collectNovel(NovelActivity.this.novelId, !NovelActivity.this.novelDetailBean.getIsLike());
            NovelActivity.this.novelDetailBean.setIsLike(!NovelActivity.this.novelDetailBean.getIsLike());
            if (NovelActivity.this.novelDetailBean.getIsLike()) {
                ToastUtils.getInstance().showCorrect("收藏成功");
                ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(0);
                ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(R.drawable.ic_novel_collect_ok);
                return;
            }
            ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(0);
            ((ActivityNovelBinding) NovelActivity.this.binding).ivCollect.setImageResource(R.drawable.ic_novel_collect_no);
        }

        public void commentNovel() {
            NovelActivity.this.ll_root.startAnimation(NovelActivity.this.animationIn);
            NovelActivity.this.novelCommentFragment.loadNovelComment(0, NovelActivity.this.novelId, NovelActivity.this.novelChapterId, NovelActivity.this.commentNum, 0);
            NovelActivity.this.novelCommentFragment.show(NovelActivity.this.getSupportFragmentManager(), "novelCommentFragment");
        }

        public void donateNovel() {
            ToastUtils.getInstance().showCorrect("打赏");
        }
    }

    /* access modifiers changed from: protected */
    @Override // androidx.appcompat.app.AppCompatActivity, androidx.fragment.app.FragmentActivity, com.androidx.p013lv.base.p015ui.BaseActivity
    public void onDestroy() {
        super.onDestroy();
        if (this.loading != null) {
            this.loading = null;
        }
    }
}
